<%@ page import="po.Good" %>
<%@ page import="dao.GoodDao" %>
<%@ page import="dao.impl.GoodDaoImpl" %>
<%@ page import="po.Record" %>
<%@ page import="dao.RecordDao" %>
<%@ page import="dao.impl.RecordDaoImpl" %>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
</head>
<body>

<%
    String goodid = request.getParameter("goodid");
    String warehouseId=request.getParameter("warehouseId");
    int count = Integer.parseInt(request.getParameter("count"));
    String shipper=request.getParameter("shipper");
    GoodDao dao = new GoodDaoImpl();
    Good good = dao.getGood(goodid);

    Record record = new Record();
    record.setGoodId(goodid);
    record.setGoodName(good.getGoodName());
    record.setType(good.getType());
    record.setCount(count);
    record.setCost(good.getCost());
    record.setShipper(shipper);
    record.setWarehouseId(warehouseId);

    RecordDao recordDao=new RecordDaoImpl();
    recordDao.addRecord(record);

    response.sendRedirect("goodManage.jsp");
%>
</body>
</html>
